var saveGoodsRlueTreeWin = function(salesRuleId, title, rights) {
	var b = new Ext.ux.TreeCheckPanel({
		id : "roleGrantVillageView",
		checkModel : 'cascade', // 对树的级联多选
		onlyLeafCheckable : true,// 对树所有结点都可选
		autoScroll : true,
		rootVisible : false,
		animate : false,
		lines : true,
		loader : new Ext.ux.TreeCheckLoader({
			dataUrl : __ctxPath
					+ "/couponRuleManager/selectGoodsTree?goodsStatus=1&salesRuleId="
					+ salesRuleId + "&isDelete=0",
			preloadChildren : true
		}),
		root : new Ext.tree.AsyncTreeNode({
					expanded : true
				}),
		tbar : [{
					xtype : "button",
					text : "展开",
					iconCls : "btn-expand",
					scope : this,
					handler : function() {
						b.expandAll();
					}
				}, {
					xtype : "tbseparator"
				}, {
					xtype : "button",
					text : "收起",
					iconCls : "btn-collapse",
					scope : this,
					handler : function() {
						b.collapseAll();
					}
				}, {
					xtype : "tbseparator"
				}, "->", {
					id : "refresh",
					xtype : "button",
					text : "刷新",
					iconCls : "btn-refresh",
					handler : function() {
						b.getRootNode().reload();
					}
				}]
	});
	b.expandAll();
	b.on('expandnode', function(node) {
				var childln = node.childNodes.length;
				for (var i = 0; i < childln; i++) {
					var selectln = rights.length;
					if (selectln > 0) {
						var tmpNode = node.childNodes[i];
						for (var j = 0, riLen = rights.length; j < riLen; j++) {
							if (tmpNode.id == rights[j]) {
								tmpNode.getUI().checkbox.checked = true;
								tmpNode.attributes.checked = true;
							};
						}
					}
				}
			});
	var d = new Ext.Window({
		id : "RoleGrantVillageView",
		title : title,
		width : 500,
		height : 500,
		modal : true,
		layout : "fit",
		plain : true,
		items : [b],
		buttonAlign : "center",
		buttons : [{
			text : "保存",
			handler : function() {
				Ext.Msg.confirm("提示框", "确认保存商品规格吗？", function(button) {
					if (button == "yes") {
						var optionMask = new Ext.LoadMask(Ext.getBody(), {
								msg : "正在处理,请稍后..."
							});
					optionMask.show();
						Ext.Ajax.request({
									url : __ctxPath
											+ "/couponRuleManager/updateGoodsRule",
									method : "POST",
									params : {
										salesRuleId : salesRuleId,
										goodsPriceSizeIds : b.getValue()
												.toString()
									},
									success : function(response, options) {
										optionMask.hide();
										var jsonData = Ext.util.JSON
												.decode(response.responseText);
										if (jsonData.success) {
											Ext.MessageBox.show({
														title : "信息提示",
														msg : jsonData.data,
														buttons : Ext.MessageBox.OK,
														icon : Ext.MessageBox.INFO
													});
											d.close();
										} else {
											Ext.MessageBox.show({
														title : "错误提示",
														msg : jsonData.data,
														buttons : Ext.MessageBox.OK,
														icon : Ext.MessageBox.ERROR
													});
										}
									},
									failure : function(response, options) {
										optionMask.hide();
										Ext.MessageBox.show({
													title : "操作信息",
													msg : "服务器请求异常，请稍后再试!",
													buttons : Ext.MessageBox.OK,
													icon : Ext.MessageBox.ERROR
												});
									},
									scope : this
								});
					}

				});
			}
		}, {
			xtype : "tbseparator"
		}, {
			text : "取消",
			handler : function() {
				d.close();
			}
		}]
	});
	return d;
};
